<!DOCTYPE html>
<html lang="zh-cn" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
</head>
<body>
<form id="form" class="layui-form-pane layui-form">
    <input type="hidden" id="fileId" name="fileId" th:value="${b.getFileId()}">
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">标题：</label>
        <div class="layui-input-block">
            <input class="layui-input" id="title" name="title" th:value="${b.getTitle()}" autocomplete="off"/>
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">描述：</label>
        <div class="layui-input-block">
            <input class="layui-input" id="description" name="description" th:value="${b.getDescription()}" autocomplete="off"/>
        </div>
    </div>
    <br/>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">分组：</label>
        <div class="layui-input-block" style="width: 185px">
            <select id="filegroupId" name="filegroupId" class="layui-select"  lay-verify="required" lay-search="">
                <option th:each="group:${groups}" th:selected="${group.getFilegroupId() == b.getFilegroupId()}"  th:value="${group.getFilegroupId()}" th:text="${group.getFgname()}"></option>
            </select>
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">单价：</label>
        <div class="layui-input-block" style="width: 185px">
            <select id="price" name="price" class="layui-select"  lay-verify="required" lay-search="">
                <option th:each="i:${#numbers.sequence(0,5)}" th:selected="${i*10+'' == b.getPrice()+''}" th:value="${i*10}" th:text="${i*10}+积分"></option>
            </select>
        </div>
    </div>
   <br/>
    <div class="layui-form-item layui-inline" style="float: right; margin-right: 10px;">
        <button class="layui-btn" id="updateUser">提交</button>
        <button class="layui-btn layui-btn-danger" onclick="closePage()">关闭</button>
    </div>
</form>

</body>
<script th:src="@{/layui/layui.js}"></script>
<script th:src="@{/js/jquery-2.1.0.js}"></script>
<script>
    var index = parent.layer.getFrameIndex(window.name);
    layui.use('form',function(){
        var form = layui.form;
        form.render();
    });
    layui.use('layer',function(){
        var layer=layui.layer;
    });
    function closePage() {
        parent.layer.close(index);//关闭当前页
    }

    $('#updateUser').click(function(){
        $.ajax({
            type:'post',
            url:'/file/updateFile',
            data:$("#form").serialize(),
            dataType: "text",
            async: false,
            success:function (data) {

                if (data === 1){
                }
            }
        });
        window.parent.location.reload();//刷新父页面
        parent.layer.close(index);
    });

</script>
</html>